﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using sydfdl.TMS.Model;
using sydfdl.TMS.Tool;

namespace sydfdl.TMS.BLL
{
    public class BLLT_E_Damage
    {
        /// <summary>
        /// 数据操作
        /// </summary>
        /// <param name="xml">第一个是增加，第二个是修改，第三个是删除</param>
        /// <returns></returns>
        public string Save(params IEnumerable<T_E_Damage>[] xml)
        {
            string strResult = "";
            string addXML = EFHelp<T_E_Damage>.GetXML(xml[0]);
            string editXML = EFHelp<T_E_Damage>.GetXML(xml[1]);
            string delXML = EFHelp<T_E_Damage>.GetXML(xml[2]);
            SqlParameter[] para
                =  {
                       new SqlParameter("@addXmL",SqlDbType.Xml,-1),
                       new SqlParameter("@editXML",SqlDbType.Xml,-1),
                       new SqlParameter("@delXML",SqlDbType.Xml,-1),
                       new SqlParameter("@userXML",SqlDbType.Xml,-1),
                       new SqlParameter("@ReturnValue",SqlDbType.VarChar,100)
                    };
            para[0].Value = addXML;
            para[1].Value = editXML;
            para[2].Value = delXML;
            para[3].Value = null;
            para[4].Direction = ParameterDirection.Output;
            SqlHelper.ExecuteNonQuery(SqlHelper.tmsConn, CommandType.StoredProcedure, @"P_E_SaveDamage", para);
            strResult = para[4].Value.ToString();
            return strResult;
        }
    }
}
